package com.boot.security.server.dao.record;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.record.TswChattingRecords;

@Mapper
public interface TswChattingRecordsDao {

    @Select("select * from tsw_chatting_records t where t.id = #{id}")
    TswChattingRecords getById(Long id);

    @Delete("delete from tsw_chatting_records where id = #{id}")
    int delete(Long id);

    int update(TswChattingRecords tswChattingRecords);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_chatting_records(user_id, sys_user_id, chat_content, chat_image_ids, create_time, chat_note, chat_remark) values(#{userId}, #{sysUserId}, #{chatContent}, #{chatImageIds}, #{createTime}, #{chatNote}, #{chatRemark})")
    int save(TswChattingRecords tswChattingRecords);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswChattingRecords> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
